package portal.web.servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import portal.web.delegate.IPortalWebDelegate;
import portal.web.delegate.PortalWebDelegate;

@WebServlet("/Compras/ComprarRemoveCart")
public class ComprarRemoveCart extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1907367429590975692L;

	public ComprarRemoveCart() {
		super();
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		doGet(request, response);

	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		IPortalWebDelegate app = PortalWebDelegate.getInstanace();

		Long IdCompra = new Long(request.getParameter("ID_Compra"));
		Long IdArticulo = new Long(request.getParameter("ID_Producto"));
		
		try {
			app.eliminarItemCompra(IdCompra, IdArticulo);
		} catch (Exception e) {
			// TODO: Agregar LOG4J
			e.printStackTrace();
			response.getWriter().print("Error - El item compra no fue Eliminado");
		}

	}

}
